#define _CRT_SECURE_NO_WARNINGS
#include"UnionFindSet.h"
//并查集的数据结构实现
// 测试示例
int main()
{
    // 测试1: 使用列表初始化
    DSU::UnionFindSet<string> ufs1 = { "Alice", "Bob", "Charlie", "David", "Eve" };

    std::cout << "测试1 - 列表初始化:" << std::endl;
    ufs1.DisplayAllSets();
    std::cout << "集合个数: " << ufs1.GetSetCount() << std::endl;
    std::cout << std::endl;

    // 测试2: 使用列表初始化 + 批量合并
    DSU::UnionFindSet<string> ufs2 = { "Alice", "Bob", "Charlie", "David", "Eve" };

    // 使用initializer_list进行批量合并
    ufs2.Union({ {"Alice", "Bob"}, {"Charlie", "David"}, {"Bob", "Charlie"} });

    std::cout << "测试2 - 批量合并后:" << std::endl;
    ufs2.DisplayAllSets();
    std::cout << "集合个数: " << ufs2.GetSetCount() << std::endl;
    std::cout << std::endl;

    // 测试3: 默认构造 + 批量添加
    DSU::UnionFindSet<string> ufs3;
    ufs3.AddElements({ "Apple", "Banana", "Cherry", "Date", "Elderberry" });

    std::cout << "测试3 - 批量添加元素:" << std::endl;
    ufs3.DisplayAllSets();
    std::cout << "集合个数: " << ufs3.GetSetCount() << std::endl;
    std::cout << std::endl;

    // 合并操作
    ufs3.Union("Apple", "Banana");
    ufs3.Union("Cherry", "Date");

    std::cout << "测试3 - 合并后:" << std::endl;
    ufs3.DisplayAllSets();
    std::cout << "集合个数: " << ufs3.GetSetCount() << std::endl;

    return 0;
}
